package com.bases {
	import com.skin.SkinManage;
	import flash.events.MouseEvent;

	public class TRadioButton extends TUIComponent {
		private var btnSelect:ImageButton;
		private var btnNotSelect:ImageButton;
		private var _select:Boolean = false;

		public function TRadioButton(){
			super();
			btnSelect = new ImageButton(SkinManage.getInstance().getClass('RadioSelectUp'), SkinManage.getInstance().getClass('RadioSelectUp'), SkinManage.getInstance().getClass('RadioSelectUp'));
			btnNotSelect = new ImageButton(SkinManage.getInstance().getClass('RadioNotSelectUp'), SkinManage.getInstance().getClass('RadioNotSelectUp'), SkinManage.getInstance().getClass('RadioNotSelectUp'));
			this.addChilds(btnSelect, btnNotSelect);
			btnSelect.visible = false;
			//点击单击事件
			this.addEventListener(MouseEvent.CLICK, onAddSelect);
		}

		protected function onAddSelect(event:MouseEvent):void {
			this.select = !this.select;
		}

		public function set select(value:Boolean):void {
			if (value == true){
				this.btnSelect.visible = true;
				this.btnNotSelect.visible = false;
			} else {
				this.btnNotSelect.visible = true;
				this.btnSelect.visible = false;
			}
			_select = value;
		}

		public function get select():Boolean {
			return _select;
		}
	}
}